<extend name="Layout/ins_page" />
<block name="content">
	{:W('PageHeader/adv_search',array('name'=>$folder_name,'search'=>'M'))}
	<div class="x-panel hidden"  id="adv_search">
		<form method="post" name="form_adv_search" id="form_adv_search" >
			<div class="x-panel-header">
				<h4>高级搜索</h4>
				<div class="split"></div>
				<a  class="btn" id="submit_adv_search">搜索</a>
				<a  class="btn btn-cancel" id="close_adv_search">关闭</a>
			</div>
			<div class="x-panel-body">
				<div class="frame">
					<div class="bit-2">
						<div class="layui-form-item ">
							<label class=" layui-form-label" for="li_name">标题：</label>
							<div class="layui-input-block">
								<input  class="layui-input" type="text" id="li_name" name="li_name" >
							</div>
						</div>
					</div>
					<div class="bit-2">
						<div class="layui-form-item">
							<label class=" layui-form-label" for="li_content">内容：</label>
							<div class="layui-input-block">
								<input  class="layui-input" type="text" id="li_content" name="li_content" >
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="frame">
				<div class="bit-2">
					<div class="layui-form-item ">
						<label class="layui-form-label" for="eq_user_name">登录人：</label>
						<div class="layui-input-block">
							<input  class="layui-input" type="text" id="eq_user_name" name="eq_user_name" >
						</div>
					</div>
				</div>
				<div class="bit-2">
					<div class="layui-form-item">
						<div class="layui-inline">
							<label class="layui-form-label">登录时间：</label>
							<div class="layui-input-inline" style="width: 100px;">
								<input type="text" class="layui-input" name="be_create_time" readonly="readonly"/>
							</div>
							<div class="layui-form-mid">
								-
							</div>
							<div class="layui-input-inline" style="width: 100px;">
								<input type="text" class="layui-input" name="en_create_time" readonly="readonly"/>
							</div>
						</div>
					</div>
				</div>
			</div>
		</form>
	</div>
	<if condition="$auth['write']">
		<div class="oprator-panel">
			<if condition="$auth['admin']">
				<div class="x-select col-16 layui-input-inline" >
					<select class="layui-input" id="move_to">
						<option value="">转移到</option>
						{:fill_option($folder_list)}
					</select>
				</div>
				<a class="btn btn-del" id="btn_del">删除</a>
			</if>
			<div class="split"></div>
			<a class="btn" id="btn_add">新建</a>
		</div>
	</if>
	<div class="ul-table">
		<ul>
			<li class="thead">
				<span class="col-2 x-checkbox">
					<input  type="checkbox"class="toggle-select-all" data="id[]"/>
				</span>
				<span class="col-10 grow-1"> 标题 </span>
				<span class="col-10"> 编号 </span>
				<span class="col-10"> 登录时间 </span>
				<span class="col-6"> 登录人 </span>
			</li>
			<empty name="list">
				<li class="no-data">
					没找到数据
				</li>
				<else/>
				<form method="post" action="" name="form_data" id="form_data">
					<foreach name="list" item="vo">
						<li class="tbody  <php> if(in_array($vo['id'],$unread_info)) echo("bold")</php>" >
							<span class="x-checkbox col-2">
								<input  type="checkbox" name="id[]" value="{$vo.id}" />
							</span>
							<span class="col-10 grow-1"> <a href="{:U('read','id='.$vo['id'])}" >{$vo.name}
								<eq name="vo.name|strlen" value="0">
									无标题
								</eq></a> </span>
							<span class="col-10"> {$vo.doc_no} </span>
							<span class="col-10 "> {$vo.create_time|to_date='Y-m-d'} </span>
							<span class="col-6 "> {$vo.user_name} </span>
						</li>
					</foreach>
				</form>
			</empty>
		</ul>
		<notempty name="list">
			<div class="pagination">
				{$page}
			</div>
		</notempty>
	</div>
</block>
<block name="js">
	<script type="text/javascript">
		layui.use(['global'], function() {
			var $ = layui.jquery;
			set_return_url(null);

			$("#btn_add").on('click', function() {
				window.open("{:U('add','fid='.$fid)}", "_self");
			});

			$("#move_to").on('change', function() {
				if (this.value !== '') {
					move_to(this.value);
				}
			});

			$("#btn_del").on('click', function() {
				if ($("input[name='id[]']:checked").length == 0) {
					layer.msg('请选择要删除的项目');
					return false;
				}
				layer.msg('确定要删除吗?', {
					time : 0,
					btn : ['确定', '取消'],
					yes : function(index) {
						var vars = $("#form_data").serialize();
						send_ajax("{:U('del')}", vars, function(ret) {
							if (ret.status) {
								layer.msg(ret.info, function() {
									location.reload(true);
								});
							}
						});
					},
					no : function(index) {
						layer.close(index);
					}
				});
			});

			function move_to(val) {
				var vars = $("#form_data").serialize();
				send_ajax("{:U('move_to')}", 'val=' + val + '&' + vars, function(data) {
					if (data.status) {
						layer.msg(data.info, function() {
							location.reload(true);
						});
					}
				});
			};
		});
	</script>
</block>